/**
 * Created by wxb on 2019/05/20.
 */
'use strict';

angular.module('BlurAdmin')
  .factory('hotelManageUrl', function (publicFunc) {
    var prefix = '';
    var url = {
      record_list: {
        url: '/kt/admin/hotel/record',
        method: 'GET'
      },
      audit_item: {
        url: '/kt/admin/hotel/record/{recordId}/audit',
        method: 'POST'
      },
      flight_list: {
        url: '/kt/admin/flight/record',
        method: 'GET'
      },
      audit_flight: {
        url: '/kt/admin/flight/record/{recordId}/audit',
        method: 'POST'
      },
      code_list: {
        url: '/kt/admin/hotel/code',
        method: 'GET'
      },
      flight_code: {
        url: '/kt/admin/flight/code',
        method: 'GET'
      },
      staff_list: {
        url: '/kt/admin/staff',
        method: 'GET'
      },
      company_list: {
        url: '/kt/admin/company',
        method: 'GET'
      },
      add_company: {
        url: '/kt/admin/company',
        method: 'POST'
      },
      update_company: {
        url: '/kt/admin/company/{companyId}',
        method: 'PUT'
      },
      delete_company: {
        url: '/kt/admin/company/{companyId}',
        method: 'DELETE'
      },
      all_company: {
        url: '/kt/admin/company/list',
        method: 'GET'
      },
      add_staff: {
        url: '/kt/admin/staff',
        method: 'POST'
      },
      update_staff: {
        url: '/kt/admin/staff/{staffId}',
        method: 'PUT'
      },
      delete_staff: {
        url: '/kt/admin/staff/{staffId}',
        method: 'DELETE'
      },
      change_password: {
        url: '/kt/admin/staff/change/password',
        method: 'POST'
      },







    };
    return publicFunc.urlAddPrefix(url, prefix);
  })
  .service('hotelManageService', function (httpService, hotelManageUrl) {
    this.recordList = function (queryParams) {
      return httpService.http({}, hotelManageUrl.record_list, queryParams)
    };
    this.auditItem = function (postData, queryParams) {
      return httpService.http(postData, hotelManageUrl.audit_item, queryParams)
    };
    this.flightList = function (queryParams) {
      return httpService.http({}, hotelManageUrl.flight_list, queryParams)
    };
    this.auditFlight = function (postData, queryParams) {
      return httpService.http(postData, hotelManageUrl.audit_flight, queryParams)
    };
    this.codeList = function (queryParams) {
      return httpService.http({}, hotelManageUrl.code_list, queryParams)
    };
    this.flightCode = function (queryParams) {
      return httpService.http({}, hotelManageUrl.flight_code, queryParams)
    };
    this.staffList = function (queryParams) {
      return httpService.http({}, hotelManageUrl.staff_list, queryParams)
    };
    this.companyList = function (queryParams) {
      return httpService.http({}, hotelManageUrl.company_list, queryParams)
    };
    this.addCompany = function (postData) {
      return httpService.http(postData, hotelManageUrl.add_company, {})
    };
    this.updateCompany = function (postData, companyId) {
      return httpService.http(postData, hotelManageUrl.update_company, {companyId: companyId})
    };
    this.deleteCompany = function (companyId, status) {
      return httpService.http({}, hotelManageUrl.delete_company, {companyId: companyId, status: status})
    };
    this.allCompany = function () {
      return httpService.http({}, hotelManageUrl.all_company, {})
    };
    this.addStaff = function (postData) {
      return httpService.http(postData, hotelManageUrl.add_staff, {})
    };
    this.updateStaff = function (postData, staffId) {
      return httpService.http(postData, hotelManageUrl.update_staff, {staffId: staffId})
    };
    this.deleteStaff = function (staffId, status) {
      return httpService.http({}, hotelManageUrl.delete_staff, {staffId: staffId, status: status})
    };
    this.changePassword = function (postData) {
      return httpService.http(postData, hotelManageUrl.change_password, {})
    };

  });
